<?php defined('_JEXEC') or die('Restricted access'); ?>

<script src="<?php echo $this->template_dir ;?>jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="<?php echo $this->template_dir ;?>jquery/validate/jquery.validate.js" type="text/javascript"></script>
<form action="<?php echo $this->action ?>" method="post" name="kontaktForm" id="kontaktForm">
<div class="w745 float_left bg_color_1">
            	<div class="bs1b">
                    <div class="title_2">CONTACT US</div>
                </div>
                <div class="h600 p25t">
                	<div class="w245 float_left">
                    	<div class="p20l p25t">
                            <?php
                            	 jimport('mylibs.globalModel');
								 $globalModel = new globalModel();
								 $intro = $globalModel->getArticle(3); 
                    			 echo $intro['introtext'];               
                            ?>
                        </div>
                    </div>
                    <div class="w500 float_left p25t">
                    	<div class="input_new">
                        	<label>Your name</label><br />
                            <input id="name" name="name" type="text" value="" class="w315" /><br />
                            <label>E-mail</label><br />
                            <input id="email" name="email" type="text" value="" class="w315" /><br />
                            <label>Message subject</label><br />
                            <input id="subject" name="subject" type="text" value="" class="w315" /><br />
                            <label>Your message</label><br />
                            <textarea id="message" name="message" rows="6" class="w315"></textarea><br />
                            <input type="submit" style="background:url(<?php echo $this->template_dir?>img/bt_send.png);width:55px;height:20px" value="" />
                            <input type="reset" style="background:url(<?php echo $this->template_dir?>img/bt_reset.png);width:55px;height:20px" value="" />
                            
                        </div>
                        
                    </div>
                    <div class="clear_left"></div>
                </div>
            </div>
            <div class="clear_left"></div>
        </div>
<input type="hidden" name="option" value="com_kontakt" />
<input type="hidden" name="controller" value="" />
<input type="hidden" name="task" id="task" value="submit" />
<?php echo JHTML::_( 'form.token' ); ?>
</form>
<script language="javascript">
	jQuery(document).ready(function($) {
		//jQuery.updnWatermark.attachAll();
			
		jQuery("#kontaktForm").validate({
			errorPlacement: function(error, element) {			
			},
			invalidHandler: function(form, validator) {
			  var errors = validator.numberOfInvalids();
			  if (errors) {
				alert(validator['errorList'][0]['message']);
				validator['errorList'][0]['element'].focus();
			  } else {
			  }
			},

			rules: {
				name: "required",
				subject: "required",
				message: "required",
				email: {
					required: true,
					email: true
				}
			},
			messages: {
				name: "<?php echo JText::_( 'Please enter your name' ); ?>",
				subject: "<?php echo JText::_( 'Please enter subject' ); ?>",
				message: "<?php echo JText::_( 'Please enter message' ); ?>",
				email: "<?php echo JText::_( 'Please enter a valid email address' ); ?>"
			}
		});
	});
</script>
